{extend name="public/base" /}

{block name="style"}
<style>
    .temp-model {
        width: 100px;
        height: 40px;
        overflow: hidden;
        margin-bottom: 10px;
    }
    .temp-model-img {
        width: 100%;
    }
</style>
{/block}

{block name="content"}
<div class="container-fluid">
    <div class="breadcrumb-wrapper row">
        <div class="col-12 col-lg-3 col-md-6">
            <h4 class="page-title">编辑模板</h4>
        </div>
        <div class="col-12 col-lg-9 col-md-6">
            <ol class="breadcrumb float-right">
                <li><a href="{:url('Manage/home')}">控制台</a></li>
                <li class="active"> / 编辑模板</li>
            </ol>
        </div>
    </div>
</div>

<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{:url('Temp/editTempDo')}" enctype="multipart/form-data" method="post">
                        <input type="hidden" name="id" value="{$info.id}">
                        <div class="form-group">
                            <label>分类</label>
                            <select class="form-control" name="type_id">
                                <option value="1"
                                        {eq name="info.type_id" value="1"}
                                        selected
                                        {/eq}
                                >电脑</option>
                                <option value="2"
                                        {eq name="info.type_id" value="2"}
                                        selected
                                        {/eq}
                                >手机</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label>行业</label>
                            <select class="form-control" name="cate_id">
                                {volist name="cateList" id="item"}
                                <option value="{$item.id}"
                                        {eq name="item.id" value="$info.cate_id"}
                                        selected
                                        {/eq}
                                >{$item.name}</option>
                                {/volist}
                            </select>
                        </div>

                        <div class="form-group">
                            <label>颜色</label>
                            <select class="form-control" name="color_id">
                                {volist name="colorList" id="item"}
                                <option value="{$item.id}" style="color: #{$item.value}"
                                        {eq name="item.id" value="$info.color_id"}
                                        selected
                                        {/eq}
                                >{$item.name}</option>
                                {/volist}
                            </select>
                        </div>

                        <div class="form-group">
                            <label>价格</label>
                            <input class="form-control" type="number" min="0" name="temp_price" value="{$info.temp_price}">
                        </div>

                        <div class="form-group">
                            <label>链接</label>
                            <input class="form-control" type="text" name="temp_link" value="{$info.temp_link}">
                        </div>

                        <div class="form-group">
                            <label>图片</label>
                            <div class="temp-model">
                                <a href="/uploads/{$info.temp_img}" target="_blank">
                                    <img src="/uploads/{$info.temp_img}" class="temp-model-img">
                                </a>
                            </div>
                            <input class="form-control" type="file" name="temp_img">
                        </div>
                        <br>
                        <button type="submit" class="btn btn-common">提交保存</button>
                        <a href="{:url('Temp/tempList')}" class="btn btn-light">返回列表</a>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}